package com.micro.turtle.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 指令集
 *
 * @author jason.lv
 * @since 2022/1/21 19:27
 */
@AllArgsConstructor
public enum Cmd {

    /**
     * 指令集
     */
    HELP("help", "查看帮助"),
    EXIT("exit", "退出"),
    CONF("conf", "配置"),
    GROUP("g", "获取所有组"),
    SUB_GROUP("sg", "获取子组"),
    PROJECTS("prj", "获取组下项目"),
    PIPES("pis", "获取项目流水线"),
    PIPE_CREATE("pic", "创建项目流水线"),
    PIPE_BATCH("picb", "批量创建项目流水线"),
    JOBS("jos", "获取流水线作业"),
    JOB_DETAIL("jobd", "获取流水线作业详情"),
    JOB_PLAY("jop", "执行流水线作业"),
    RELEASE("release", "发布Release"),
    ;
    @Getter
    private final String cmd;
    @Getter
    private final String desc;

    public static Cmd get(String cmd) {
        for (Cmd value : values()) {
            if (value.cmd.equals(cmd)) {
                return value;
            }
        }
        return HELP;
    }

}
